package com.sajus.web.billing.ejb.data.model;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name = "promooffering")
@NamedQueries({
	@NamedQuery(name = "PromoOffering.findAll", query = "SELECT r FROM PromoOffering r"),
	@NamedQuery(name = "PromoOffering.findCurrentIndex", query = "SELECT r FROM PromoOffering r WHERE r.id= ( SELECT max(d.id) FROM PromoOffering d )" )
	})
public class PromoOffering extends PersistentObject {
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name = "id")
	private Integer id;
	
	private String description;
	
	@ManyToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "servicetype")
	private ServiceType servicetype;
	
	@ManyToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "finalOffering")
	private Offering finalOffering;
	
	@ManyToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "initialOffering")
	private Offering initialOffering;
	
	@ManyToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "promotion")
	private Promotion promotion;

	@Override
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public ServiceType getServicetype() {
		return servicetype;
	}

	public void setServicetype(ServiceType servicetype) {
		this.servicetype = servicetype;
	}

	public Offering getFinalOffering() {
		return finalOffering;
	}

	public void setFinalOffering(Offering finalOffering) {
		this.finalOffering = finalOffering;
	}

	public Offering getInitialOffering() {
		return initialOffering;
	}

	public void setInitialOffering(Offering initialOffering) {
		this.initialOffering = initialOffering;
	}

	public Promotion getPromotion() {
		return promotion;
	}

	public void setPromotion(Promotion promotion) {
		this.promotion = promotion;
	}

}
